package com.ctu.gzero.elements
{
	import com.ctu.gzero.utils.GzLogger;
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.ui.Mouse;
	import flash.ui.MouseCursor;
	
	import mx.logging.*;
	import mx.logging.targets.*;
	
	public class ObjectRun extends RunElement
	{
		private var  _type:String = "ObjectRun";
		private var _left:Number;
		private var _top:Number;
		private var _width:Number;
		private var _height:Number;
		private var _x:Number;
		private var _y:Number;
		private var _backgroundColor:uint;
		private var _alpha:Number;
		private var _margin:Number = 0;
		
		private var _obj:Sprite;
		
		public function ObjectRun()
		{
			super.logger = GzLogger.getLogger("ObjectRun");
		}
		
		private function mouseOverHandler(event:MouseEvent):void
		{
			Mouse.cursor = MouseCursor.ARROW;
			event.stopPropagation();
		}
		
		private function mouseOutHandler(event:MouseEvent):void
		{
			Mouse.cursor = MouseCursor.AUTO;
			event.stopPropagation();
		}
		
		public function get width():Number
		{
			return _width;
		}
		
		public function set width(val:Number):void
		{
			_width = val;
		}
		
		public function get height():Number
		{
			return _height;
		}
		
		public function set height(val:Number):void
		{
			_height = val;
		}
		
		public function get backgroundColor():uint
		{
			return _backgroundColor;
		}
		
		public function set backgroundColor(val:uint):void
		{
			_backgroundColor = val;
		}
		
		public function get alpha():Number
		{
			return _alpha;
		}
		
		public function set alpha(val:Number):void
		{
			_alpha = val;
		}
		
		public function get top():Number
		{
			return _top;
		}
		
		public function set top(val:Number):void
		{
			_top = val;
		}
		
		public function get left():Number
		{
			return _left;
		}
		
		public function set left(val:Number):void
		{
			_left = val;
		}
		
		public function get x():Number
		{
			return _x;
		}
		
		public function set x(val:Number):void
		{
			_x = val;
		}
		
		public function get y():Number
		{
			return _y;
		}
		
		public function set y(val:Number):void
		{
			_y = val;
		}
		
		public function get margin():Number
		{
			return _margin;
		}
		
		public function set margin(val:Number):void
		{
			_margin = val;
		}
		
		public function get obj():Sprite
		{
			return _obj;
		}
		
		public function set obj(val:Sprite):void
		{
			_obj = val;
			_obj.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
			_obj.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
		}
		
		override public function get type():String
		{
			return this._type;	
		}

	}
}